package com.kitbox.hl.meshow.service.impl;

import com.kitbox.hl.meshow.dao.ListenerMapper;
import com.kitbox.hl.meshow.service.ICamundaHookService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Auther: honglei
 * @Date: 2019/9/4 11:44
 * @Description:
 */
@Service
public class CamundaHookImpl implements ICamundaHookService {

    private final Logger logger = LoggerFactory.getLogger(CamundaHookImpl.class);
    @Autowired
    private ListenerMapper listenerMapper;

    @Override
    public int reportUrl(String processDefinitionId, String url, String processInstanceId, int type) {
        List<String> list=listenerMapper.findUrl(processDefinitionId,processInstanceId,type);
        if (list!=null&&list.size()>0)
        {
            return 1;
        }
        return listenerMapper.insertUrl(processDefinitionId,processInstanceId,url,type);
    }
}
